home *** CD-ROM | disk | FTP | other *** search
- From: Drooge@msn.com (Gregory Block)
- Subject: RE: ?? pointer to function in C++
- Date: 6 Jan 96 21:22:43 -0800
- References: <4c2pm4$69d@enterprise.sct.gu.edu.au>
- Message-ID: <00001a81+0000893b@msn.com>
- Path: news.msn.com!msn.com
- Newsgroups: comp.lang.c++
- Organization: The Microsoft Network (msn.com)
-
- You can take a pointer to a class method in C++, but the compiler
- enforces that the method be bound to a class object. I use the IBM
- CSet++ compiler (OS/2) and can compile the following:
-
- class MyClass
- {
- typedef void (MyClass::*pfnFunc)();
-
- void whatever_1();
- void whatever_2();
-
- };
-
- MyClass::whatever_1()
- {
- pfnFunc func = whatever_2;
- (this->func)(); // calls whatever_2
- }
-
- But I'm typing this from memory, so I'm sure you'll find some typos...
-
-